package com.gbb.common;

import android.app.Application;
import androidx.annotation.NonNull;

/**
 * 获取Application工具类
 *
 * @author gaobingbing on 2017/12/20 0020.
 */
public final class AppUtils {

    private static Application application;

    private AppUtils() {
    }

    public synchronized static void inject(@NonNull Application app) {
        application = app;
    }

    public static Application get() {
        if(application == null) {
            throw new NullPointerException("请先在项目的Application中调用AppUtils.inject(application)");
        }
        return application;
    }

}
